* @cancellable: Cancellable
* @error: Error
*
- * Assuming @new_deployments have already been deployed in place on
- * disk, atomically update bootloader configuration.
+ * Older version of ostree_sysroot_write_deployments_with_options(). This
+ * version will perform post-deployment cleanup by default.
*/
gboolean
ostree_sysroot_write_deployments (OstreeSysroot *self,
GCancellable *cancellable,
GError **error)
{
- return _ostree_sysroot_write_deployments_internal (self, new_deployments,
- TRUE, cancellable, error);
+ OstreeSysrootWriteDeploymentsOpts opts = { .do_postclean = TRUE };
+ return ostree_sysroot_write_deployments_with_options (self, new_deployments, &opts,
+ cancellable, error);
}
+/**
+ * ostree_sysroot_write_deployments_with_options:
+ * @self: Sysroot
+ * @new_deployments: (element-type OstreeDeployment): List of new deployments
+ * @opts: Options
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Assuming @new_deployments have already been deployed in place on disk via
+ * ostree_sysroot_deploy_tree(), atomically update bootloader configuration. By
+ * default, no post-transaction cleanup will be performed. You should invoke
+ * ostree_sysroot_cleanup() at some point after the transaction, or specify
+ * `do_postclean` in @opts. Skipping the post-transaction cleanup is useful
+ * if for example you want to control pruning of the repository.
+ */
gboolean
-_ostree_sysroot_write_deployments_internal (OstreeSysroot *self,
- GPtrArray *new_deployments,
- gboolean do_clean,
- GCancellable *cancellable,
- GError **error)
+ostree_sysroot_write_deployments_with_options (OstreeSysroot *self,
+ GPtrArray *new_deployments,
+ OstreeSysrootWriteDeploymentsOpts *opts,
+ GCancellable *cancellable,
+ GError **error)
{
gboolean ret = FALSE;
guint i;
/* And finally, cleanup of any leftover data.
*/
- if (do_clean)
+ if (opts->do_postclean)
{
if (!ostree_sysroot_cleanup (self, cancellable, error))
{
g_autoptr(GPtrArray) deployments = NULL;
g_autoptr(GPtrArray) new_deployments = g_ptr_array_new_with_free_func (g_object_unref);
const gboolean postclean = (flags & OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN) == 0;
+ OstreeSysrootWriteDeploymentsOpts write_opts = { .do_postclean = postclean };
gboolean retain = (flags & OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN) > 0;
const gboolean make_default = !((flags & OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT) > 0);
gboolean added_new = FALSE;
added_new = TRUE;
}
- if (!_ostree_sysroot_write_deployments_internal (sysroot, new_deployments,
- postclean, cancellable, error))
+ if (!ostree_sysroot_write_deployments_with_options (sysroot, new_deployments, &write_opts,
+ cancellable, error))
goto out;
ret = TRUE;
GCancellable *cancellable,
GError **error);
+typedef struct {
+ gboolean do_postclean;
+ gboolean unused_bools[7];
+ int unused_ints[7];
+ gpointer unused_ptrs[7];
+} OstreeSysrootWriteDeploymentsOpts;
+
+_OSTREE_PUBLIC
+gboolean ostree_sysroot_write_deployments_with_options (OstreeSysroot *self,
+ GPtrArray *new_deployments,
+ OstreeSysrootWriteDeploymentsOpts *opts,
+ GCancellable *cancellable,
+ GError **error);
+
_OSTREE_PUBLIC
gboolean ostree_sysroot_deploy_tree (OstreeSysroot *self,
const char *osname,